package com.example.fbi_text.Acitivity;

import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.fbi_text.R;
import com.example.fbi_text.adapter.NewsAdapter;
import com.example.fbi_text.bean.News;
import com.example.fbi_text.database.DBHelper;
import com.example.fbi_text.views.HeaderView;

public class PriticularsActivity extends AppCompatActivity {
    private HeaderView mheaderview;
    private News mNews;
    private NewsAdapter mNewsAdapter;

    private TextView mTitle;
    private TextView mAuthor;
    private TextView mTime;
    private TextView mContent;
    private
    Context mContext = this;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_news_particulars);
        mheaderview = findViewById(R.id.particulars_Header);
        mTitle = findViewById(R.id.particulars_Title);
        mAuthor = findViewById(R.id.particulars_author);
        mTime = findViewById(R.id.particulars_Time);
        mContent = findViewById(R.id.particulars_Content);


//        设置头部
        mheaderview.setSerchViewVisibility(View.GONE);
        mheaderview.setTitleVisibility(View.VISIBLE);
        mheaderview.setTitle("新闻详情");
//
        String id = getIntent().getStringExtra("id");
        Log.d("TAG", "id: "+id);
        int a = Integer.parseInt(id);
        Log.d("TAG", "a: "+a);
        mNews = DBHelper.getInstance(mContext).getNewsById(a);
//      设置信息
        mTitle.setText(mNews.getNews_title());
        mAuthor.setText(mNews.getNews_author());
        mTime.setText(mNews.getNews_time());
        mContent.setText(mNews.getNews_content());


//        mLVNews.setAdapter(mNewsAdapter);


        mheaderview.setmHeaderBackClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
